{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "96596192-bd3b-4b9a-8b72-6060f63ba75b",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.svm import LinearSVC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "d00f1077-eb0c-4dc4-b80d-231590d59655",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "train_data = np.load('自动驾驶疲劳检测挑战赛公开数据-更新/train.npy')\n",
    "test_data = np.load('自动驾驶疲劳检测挑战赛公开数据-更新/test.npy')\n",
    "train_label = pd.read_csv('自动驾驶疲劳检测挑战赛公开数据-更新/train_label.csv', header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "7afcf7bd-fa8b-41b6-ace9-fbbe884b888b",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((10000, 64, 64, 3), (15000, 64, 64, 3))"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_data.shape, test_data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "53e64dd9-7aee-4248-acf3-03e7106543ab",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "m = LinearSVC()\n",
    "m.fit(train_data.reshape(10000, -1), train_label)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "5a609443-9af4-4e7c-a899-bd06a492a4dd",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "pd.DataFrame(m.predict(test_data.reshape(15000, -1))).to_csv('submit.csv', index=None, header=None)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3.10"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.10"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
